package com.project.thisConsume.controller;
import com.project.thisCommon.annotation.MethodAuthority;
import com.project.thisCommon.model.BaseResult;
import com.project.thisCommon.model.RequestBase;
import com.project.thisCommon.model.ResultBase;
import com.project.thisConsume.common.enums.SuccessCode;
import com.project.thisConsume.common.upload.FileExecutor;
import com.project.thisConsume.controller.business.FileInterface;
//import com.thisjoy.RocketRoute.executor.RocketMqProductExecutor;
import com.project.thisConsume.controller.business.UserInterface;
import com.server.thisFacade.domain.reqeust.UserRequest;
import com.server.thisFacade.domain.result.UserResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;

@RestController
@RequestMapping(value = "/consume")
public class AuthorityConsume {

    @Autowired
    UserInterface userInterface;

    @PostMapping("/test")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public ResultBase<UserResult> Test(){
        RequestBase<UserRequest> var = new RequestBase<>();
        var.setBody(new UserRequest());
        var.getBody().setId(1L);
        try {
            return userInterface.findUserInfo(var);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return ResultBase.ok(SuccessCode.SYSTEM_SUCCESS);
    }
}
